#include "CADChildWindow.h"
#include "CADView.h"
#include "CADDocument.h"
#include <QVBoxLayout>

CADChildWindow::CADChildWindow(CADDocument* pDoc, QWidget *parent, Qt::WindowFlags flags)
	: QWidget(parent, flags)
{
	m_pDoc = pDoc;
	m_pView = new CADView(this);
	pDoc->addView(this);

	auto pVBoxLayout = new QVBoxLayout();
	pVBoxLayout->addWidget(m_pView);
	this->setLayout(pVBoxLayout);
}

CADChildWindow::~CADChildWindow()
{
}

CADDocument* CADChildWindow::getDocument() const
{
	return m_pDoc;
}

void CADChildWindow::getViewActions(QList<QAction*>& mRtActions)
{
	m_pView->getViewActions(mRtActions);
}

void CADChildWindow::closeEvent(QCloseEvent * event)
{
	m_pDoc->removeView(this);
	return QWidget::closeEvent(event);
}